package com.kun.portal.webframe.po;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.GenericGenerator;
import org.springframework.format.annotation.DateTimeFormat;

import javax.persistence.*;
import java.util.Date;

/**
 * Created by Administrator on 2018/7/6.
 */

@Entity
@Table(
        name = "fbo_repair_plane"
)
@DynamicUpdate
public class RepairPlanePo {
    @Id
    @GeneratedValue(
            generator = "id"
    )
    @GenericGenerator(
            name = "id",
            strategy = "uuid"
    )
    @Column(
            name = "id",
            length = 32,
            nullable = false
    )
    private String id;

    @Column(
            name = "cycle"

    )
    private Integer cycle;

    @Column(
            name = "unit",
            length=32
    )
    private String unit;
    @Column(
            name = "flight"
    )

    private Boolean flight;

    @Column(
            name = "actual_date"
    )
    @DateTimeFormat(pattern="yyyy-MM-dd")
    @JsonFormat(pattern="yyyy-MM-dd",timezone="Asia/Shanghai")
    @Temporal(TemporalType.DATE)
    private Date actualDate;

    @Column(
            name = "plane_date"

    )
    @DateTimeFormat(pattern="yyyy-MM-dd")
    @JsonFormat(pattern="yyyy-MM-dd",timezone="Asia/Shanghai")
    @Temporal(TemporalType.DATE)
    private Date planeDate;

    @Column(
            name = "status",
            length=32
    )
    private  String status;

    @Column(
            name = "repair_type",
            length = 32
    )
    private String RepairType;

    @ManyToOne(targetEntity = EquipmentPo.class,cascade = CascadeType.DETACH)
    @JoinColumn(name = "equipment_id",referencedColumnName ="id" )
    private EquipmentPo equipmentPo;

    @ManyToOne(targetEntity = FlightInfoPo.class,cascade = CascadeType.DETACH)
    @JoinColumn(name = "flight_info_id",referencedColumnName ="flight_info_id" )
    private FlightInfoPo flightInfoPo;


    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public Integer getCycle() {
        return cycle;
    }

    public void setCycle(Integer cycle) {
        this.cycle = cycle;
    }



    public String getRepairType() {
        return RepairType;
    }

    public void setRepairType(String repairType) {
        RepairType = repairType;
    }

    public EquipmentPo getEquipmentPo() {
        return equipmentPo;
    }

    public void setEquipmentPo(EquipmentPo equipmentPo) {
        this.equipmentPo = equipmentPo;
    }

    public FlightInfoPo getFlightInfoPo() {
        return flightInfoPo;
    }

    public void setFlightInfoPo(FlightInfoPo flightInfoPo) {
        this.flightInfoPo = flightInfoPo;
    }

    public Boolean isFlight() {
        return flight;
    }

    public void setFlight(Boolean flight) {
        this.flight = flight;
    }

    public Date getPlaneDate() {
        return planeDate;
    }

    public void setPlaneDate(Date planeDate) {
        this.planeDate = planeDate;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public String getUnit() {
        return unit;
    }

    public void setUnit(String unit) {
        this.unit = unit;
    }
}
